<!--
 @description 经销商
 @fileName index.vue
 @author zengqiongying
 @created 2023/04/19 13:58:17
-->
<template>
  <div class="dealer-cell" @click="onDetail">
    <qmp-cell :is-link="!!detail.code">
      <div class="title">{{ detail.name || '--' }}</div>
      <div>{{ detail.officeName || '--' }}</div>
      <div>申请人：{{ detail.createBy || '--' }}</div>
      <slot></slot>
    </qmp-cell>
  </div>
</template>

<script lang="ts">
  import { defineComponent } from 'vue'
  import { useRouter } from 'vue-router'
  export default defineComponent({
    name: 'DealerCell',
    props: {
      detail: {
        type: Object,
        default: () => {}
      }
    },
    setup(props: any) {
      const $router = useRouter()
      const onDetail = () => {
        const code = props.detail?.code || ''
        if (!code) return
        $router.push({
          path: '/dealer/detail',
          query: {
            code
          }
        })
      }
      return {
        onDetail
      }
    }
  })
</script>
<style lang="less" scoped>
  .dealer-cell {
    position: relative;
    &:not(:last-child) {
      padding-bottom: 16px;
      &::after {
        position: absolute;
        box-sizing: border-box;
        content: ' ';
        pointer-events: none;
        left: 14px;
        right: 14px;
        bottom: 0;
        border-bottom: 1px solid var(--divisionline-weak);
        -webkit-transform: scaleY(0.5);
        transform: scaleY(0.5);
      }
    }
    /deep/.qmp-cell {
      align-items: center;
      padding: 0 14px;
      .qmp-cell__value {
        font: var(--font-main-body);
        color: var(--texticon-neutralcolor-normal);
        > div {
          margin-bottom: 4px;
          &:last-child {
            margin-bottom: 0;
          }
        }
        .title {
          font: var(--font-main-title-strengthen);
          color: var(--texticon-neutralcolor-strong);
          min-height: 20px;
        }
      }
      .qmp-cell__right-icon {
        color: var(--texticon-neutralcolor-strong);
      }
    }
  }
</style>
